#include <iostream>
#include <stdio.h>
#include <deque>
#include <vector>
#include <string.h>
#include <algorithm>

using namespace std;

vector< vector<int> > adj;
vector<int> din, dnot;
vector<bool> marked;

int n, result;

void init()
{
	result = 0;
	adj.resize(n);
	for (int i = 0; i < n; i++) adj[i].resize(0);
}




int main()
{
	while (cin >> n)
	{
		init();
		for (int i = 0; i < n; i++) 
		{
			int m, k;
			scanf ("%d:(%d)", &m, &k);
			for (int j = 0; j < k; j++)
			{
				int p;
				scanf("%d", &p);
				adj[m].push_back(p);
				adj[p].push_back(m);
			}
			scanf("\n");
		}

		if (n == 1 || n == 2) 
		{
			if (n == 1) cout << 0 << endl;
			else cout << 1 << endl;
			continue;
		}

		DFS(1);
		cout << max(din[1], dnot[1]) << endl;	
	}
		
	return 0;
}
